#include "PE3_QueueTp.h"

/*
 * @brief 
 * 私有化继承的方式中初始化使用代码中的方式
 * 因为没有包含关系里的类私有成员，所以需要直接通过私有化继承的类名直接初始化
 * 定义类公有函数时，需要使用私有类的数据也是类似的方法
 * 直接使用私有继承类名直接调用其成员进行输入输出
**/

using std::cout;
using std::cin;
using std::endl;

Worker::~Worker(){}

void Worker::data() const
{
    cout << "Name: " << fullname_ << endl ;
    cout << "Employee id: "<< id_ << endl;
}

void Worker::get()
{
    cout << "Enter a name: ";
    getline (cin,fullname_);
    cout << "Enter a id: ";
    cin >> id_;
    while(cin.get() != '\n') continue;
}

void Worker::set() 
{
    get();
}

void Worker::show() const
{
    data();
}

void Waiter::set()
{
    cout << "Waiter set:\n";
    Worker::get();
    get();
}

void Waiter::get()
{
    cout << "Enter "<< this->type() <<" panache: ";
    cin >> panache;
    while (cin.get() != '\n')    continue;
}

void Waiter::show() const
{
    cout<<"Waiter info:\n";
    Worker::data();
    data();
}

void Waiter::data() const
{
    cout << "Waiter panache: " << panache << endl;
}

const char * Singer::pv[]={"other","alto","contralto","soprano","bass","baritone","tenor"};

void Singer::get()
{
    cout << "Enter "<< this->type() <<" voice: 0=other,1=alto,2=contralto,3=soprano,4=bass,5=baritone,6=tenor\n";
    cin >> voice;
    while (voice < 0 or voice >= Vtypes)
    {
        cout << "Enter "<< this->type() <<" voice: 0=other,1=alto,2=contralto,3=soprano,4=bass,5=baritone,6=tenor\n";
        cin >> voice;
    }
    while (cin.get() != '\n')
        continue;
}

void Singer::set()
{
    cout << "Singer set ";
    Worker::get();
    get();
}

void Singer::data() const
{
    cout << "Singer voice: " << pv[voice] << endl;
}

void Singer::show() const
{
    cout<<"Singer info:\n";
    Worker::data();
    data();
}

void WaiterSinger::data() const
{
    Waiter::data();
    Singer::data();
}

void WaiterSinger::get()
{
    Waiter::get();
    Singer::get();
}

void WaiterSinger::set()
{
    cout << "WaiterSinger set:\n";
    Worker::get();
    get();
}

void WaiterSinger::show() const
{
    cout << "WaiterSinger info:\n";
    Worker::data();
    data();
}
